function multiplyBigNum (num1, num2) {
  num1 = "" + num1
  num2 = '' + num2
  let len1 = num1.length
  let len2 = num2.length
  let pos = []
  for (let i = num2.length - 1; i >= 0; i--) {
    for (let j = num1.length - 1; j >= 0; j--) {
      let index10 = i + j
      let index1 = i + j + 1
      let mul = num2[i] * num1[j] + (pos[index1] || 0)
      pos[index10] = Math.floor(mul / 10) + (pos[index10] || 0)
      pos[index1] = mul % 10
    }
  }
  return pos.join('').replace(/^0+/, '')
}
let a = '9999999'
let b = '9999999'
console.log(multiplyBigNum(a, b));